<?php

/**
 * Created by PhpStorm.
 * User: sagnitude
 * Date: 12/28/2015
 * Time: 1:11
 */
class RedisServer {
    private static $_RedisClient;

    public $_conn;

    private function __construct() {
        $parameters = [
            'tcp://192.168.1.201:7401',
            'tcp://192.168.1.201:7402',
            'tcp://192.168.1.201:7403',
            'tcp://192.168.1.201:7404',
            'tcp://192.168.1.201:7405',
            'tcp://192.168.1.201:7406',
        ];
        $options = ['cluster' => 'redis'];

        $this->_conn = new Predis\Client($parameters, $options);
    }
    public function __clone(){
        trigger_error('Clone is not allow!',E_USER_ERROR);
    }

    public static function getInstance(){
        if(!(self::$_RedisClient instanceof self)){
            self::$_RedisClient = new self;
        }
        return self::$_RedisClient;
    }

    public function test(){
        echo '调用方法成功';
    }
}

class RedisConn {}